<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 4] What's New in Java 1.1</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 15:51:01 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">
<script language='JavaScript'>
<!--
if (location.replace) {
 location.replace ('ch04_js.htm');
}
// -->
</script>

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch03_11.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 4</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch04_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<H1 CLASS=chapter><A CLASS="TITLE" NAME="JNUT2-CH-4">4. What's New in Java 1.1</A></H1>

<DIV CLASS=htmltoc>

<p>
<b>Contents:</b><br>
<a href='ch04_02.htm'>Inner Classes</a><br>
<a href='ch04_03.htm'>The New AWT Event Model</a><br>
<a href='ch04_04.htm'>Deprecated Features</a><br>
<a href='ch04_05.htm'>Other AWT Improvements</a><br>
<a href='ch04_06.htm'>Internationalization</a><br>
<a href='ch04_07.htm'>Object Serialization</a><br>
<a href='ch04_08.htm'>Reflection</a><br>
<a href='ch04_09.htm'>Java Beans</a><br>
<a href='ch04_10.htm'>Enterprise APIs: JDBC, RMI, and Security</a><br>
<a href='ch04_11.htm'>Applet Changes</a><br>
<a href='ch04_12.htm'>New JDK Utilities</a><br>
<p>
<p>
</DIV>

<P CLASS=para>
Java 1.1 is a <I CLASS=emphasis>huge</I> new release.  The number of
packages in the API has increased from 8 in Java 1.0 to 23 in Java 1.1,
and the number of classes has more than doubled from 211 to
503.  On top of these changes to the core Java class
libraries, there have been some important changes to the
language itself.  Also, the JDK--the Java Development Kit from
Sun--includes a number of new tools in version 1.1.<A NAME="CH4.JAVA-VERSION1"></A>

<P CLASS=para>
The new features of Java 1.1 include:

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>Inner classes</I><br>
<DD>

<P CLASS=para>
Changes to the Java language itself to allow
classes to be nested within each other, and within blocks of
code.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Java Beans</I><br>
<DD>

<P CLASS=para>
A framework for defining reusable modular software
components.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Internationalization</I><br>
<DD>

<P CLASS=para>
A variety of new features that make it
possible to write programs that run around the globe.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>New event model</I><br>
<DD>

<P CLASS=para>
A new model for handling events in
graphical user interfaces that should make it easier to
create those interfaces.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Other new AWT features</I><br>
<DD>

<P CLASS=para>
The Java 1.1 AWT includes support
for printing, cut-and-paste, popup menus, menu shortcuts,
and focus traversal.  It has improved support for colors,
fonts, cursors, scrolling, image manipulation, and clipping.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Applets</I><br>
<DD>

<P CLASS=para>
JAR files allow all of an applet's files to be
grouped into a single archive.  Digital signatures allow
trusted applets to run with fewer security restrictions.
The HTML <tt CLASS=literal>&lt;APPLET&gt;</tt> tag has new features.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Object serialization</I><br>
<DD>

<P CLASS=para>
Objects can now be easily "serialized" and
sent over the network or written to disk for persistent storage.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Reflection</I><br>
<DD>

<P CLASS=para>
Java programs can now "reflect" upon themselves
or upon an arbitrary class to determine the methods and
fields defined by the class, the arguments passed to a
method, and so on.  The Reflection API also allows the
invocation of methods specified by name.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Security</I><br>
<DD>

<P CLASS=para>
Java 1.1 includes a new package that supports
digital signatures, message digests, key management, and
access control lists.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Java Database Connectivity (JDBC)</I><br>
<DD>

<P CLASS=para>
A new package that allows Java programs to send SQL queries
to database servers.  It includes a "bridge" that allows it
to inter-operate with existing ODBC database servers.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>Remote Method Invocation (RMI)</I><br>
<DD>

<P CLASS=para>
An interface that supports
distributed Java applications in which a program running on
one computer can invoke methods of Java objects that exist
on a different computer.</DL>
<P CLASS=para>
These and other new features are summarized in the sections
below.  Many of them are also described in more detail
elsewhere in this book.

<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-4-SECT-1">4.1 Java 1.1 Package-by-Package</A></h2>

<P CLASS=para>
<A NAME="CH4.PACKAGES-JAV1"></A>The packages and classes of the Java class library are
interlinked and interdependent.  Many of the major new
features of Java 1.1 rely on classes from multiple packages
in the Java API.  Before we examine those new features in
detail, therefore, we need to understand the big picture of
Java 1.1.  The paragraphs below discuss each of the 23
packages that constitute the core API for Java 1.1; they
introduce the new packages and explain the changes to
existing packages.

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>java.applet</tt><br>
<DD>

<P CLASS=para>
Despite the introduction of JAR files, digitally signed
applets, and new attributes of the <tt CLASS=literal>&lt;APPLET&gt;</tt> tag, the
<tt CLASS=literal>java.applet</tt> package has not changed in any
significant way.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.awt</tt><br>
<DD>

<P CLASS=para>
<A NAME="CH4.JAVA.AWT.PAC1"></A>The <tt CLASS=literal>java.awt</tt> package contains new classes and
interfaces to support printing, popup menus, and menu
shortcuts, and to improve support for layout management,
cursors, scrolling, colors, and clipping.  Several classes
provide support for the new AWT event model, but most event
support is contained in one of several new sub-packages of
<tt CLASS=literal>java.awt</tt>.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.awt.datatransfer</tt><br>
<DD>

<P CLASS=para>
The classes and interfaces in this package define a generic
framework for inter-application (and intra-application) data
transfer.  This package also includes classes to support a
clipboard-based cut-and-paste data transfer model.  In the
future, this package may be extended to include support for
data transfer through a drag-and-drop metaphor.  One of the
two underlying data transfer mechanisms supported by this
package relies on the Object Serialization API of the
<tt CLASS=literal>java.io</tt> package.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.awt.event</tt><br>
<DD>

<P CLASS=para>
This package defines the classes and interfaces of the new
AWT event handling model.  The classes and interfaces of
this package fall into three categories:

<P>
<UL CLASS=itemizedlist>
<li CLASS=listitem>Event classes--the classes that actually represent events.

<P>
<li CLASS=listitem>Event "listeners"--interfaces that define methods that must
be implemented by objects interested in being notified
when an event of a particular type occurs.

<P>
<li CLASS=listitem>Event "adaptors"--trivial no-op implementations of the event
listener interfaces that are suitable for easy subclassing.

<P>
</UL>
<P CLASS=para>
All the events and event listeners defined in this package
extend the <tt CLASS=literal>EventObject</tt> class or the
<tt CLASS=literal>EventListener</tt> interface defined in <tt CLASS=literal>java.util</tt>.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.awt.image</tt><br>
<DD>

<P CLASS=para>
This package has two new image filter classes that
implement improved image scaling.  Changes have also been
made to the <tt CLASS=literal>MemoryImageSource</tt> and
<tt CLASS=literal>PixelGrabber</tt> classes.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.awt.peer</tt><br>
<DD>

<P CLASS=para>
The changes to this package for the most part simply reflect
changes to <tt CLASS=literal>java.awt</tt>.  There are new interfaces that
represent a platform-dependent popup menu and scrolling
area, for example.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.beans</tt><br>
<DD>

<P CLASS=para>
This package constitutes the much-touted JavaBeans API for
creating and using embeddable, reusable software
components.  The classes and interfaces in this package can
be used at three different levels:

<P>
<UL CLASS=itemizedlist>
<li CLASS=listitem>To create application builder tools that programmers (or
even non-programmers) can use to compose applications out
of individual Java beans.

<P>
<li CLASS=listitem>To develop Java beans for use in such application builders.

<P>
<li CLASS=listitem>To develop applications (without using a builder tool) that
use Java beans.

<P>
</UL>
<P CLASS=para>
Most of the classes and interfaces of the package are for
use by application builders or by developers of advanced
beans.  Programmers using beans or writing simple beans do
not need to be familiar with most of the package.

<P CLASS=para>
Application builders that manipulate beans rely on the
Reflection API defined in <tt CLASS=literal>java.lang.reflect</tt>, and
many beans take advantage of the Object Serialization API defined
in the <tt CLASS=literal>java.io</tt> package. The JavaBeans API uses the same
event model that the Java 1.1 AWT does, and event-related
classes and interfaces in this package are extensions of a
class and an interface defined in <tt CLASS=literal>java.util</tt>.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.io</tt><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>java.io</tt> package has become by far the largest of
the core Java packages.  This is because Java 1.1 adds:

<P>
<UL CLASS=itemizedlist>
<li CLASS=listitem>A complete suite of new "character stream" classes to
complement most of the existing "byte stream" input and
output classes.  These new "reader" and "writer" streams
offer improved efficiency and support internationalization
for textual input and output.

<P>
<li CLASS=listitem>New classes and interfaces to support object serialization.

<P>
<li CLASS=listitem>A number of new <tt CLASS=literal>IOException</tt> types.

<P>
</UL>
<P CLASS=para>
<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.lang</tt><br>
<DD>

<P CLASS=para>
This package has several new <tt CLASS=literal>Exception</tt> and
<tt CLASS=literal>Error</tt>
types, as well as new <tt CLASS=literal>Byte</tt>, <tt CLASS=literal>Short</tt>, and
<tt CLASS=literal>Void</tt> classes.  With the addition of these new
classes, all primitive Java data types (including the
<tt CLASS=literal>void</tt> type) have corresponding object types.  This is
important for the <tt CLASS=literal>java.lang.reflect</tt> package, which
defines the new Reflection API.  In addition, the
<tt CLASS=literal>Class</tt> class has been greatly enhanced for use with the
Reflection API.  <tt CLASS=literal>Class</tt> and <tt CLASS=literal>ClassLoader</tt> have
methods to locate "resources" associated with a
class, such as images, audio files, <tt CLASS=literal>Properties</tt>
files, and so on.  Resources are important for
internationalization in Java 1.1.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.lang.reflect</tt><br>
<DD>

<P CLASS=para>
This new package enables a Java program to examine the
structure of Java classes and to "reflect upon"
its own structure.
<tt CLASS=literal>java.lang.reflect</tt> contains classes that represent
the fields, methods,
and constructors of a class, and enable a program to obtain
complete information about any object, array, method,
constructor, or field.  The <tt CLASS=literal>java.beans</tt> package
relies heavily upon this package.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.math</tt><br>
<DD>

<P CLASS=para>
This new package contains only two classes, which support
arithmetic on arbitrary-size integers and
arbitrary-precision floating-point numbers.  The
<tt CLASS=literal>BigInteger</tt> class also defines methods for modular
arithmetic, primality testing, and other features required
for cryptography.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.net</tt><br>
<DD>

<P CLASS=para>
The changes to the <tt CLASS=literal>java.net</tt> package are quite
low-level.  They include the addition of multicast sockets,
Unix-style socket options, and new exception types that
provide finer granularity when handling networking
exceptions.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.rmi</tt><br>
<DD>

<P CLASS=para>
This package defines the fundamental classes and interfaces
used for Remote Method Invocation.  Most of the classes in
this package are exception types.  Subpackages of
<tt CLASS=literal>java.rmi</tt> provide additional, more specialized
functionality.  When objects must be passed as arguments to
remote methods, RMI relies on the object serialization
functionality provided in the <tt CLASS=literal>java.io</tt> package.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.rmi.dgc</tt><br>
<DD>

<P CLASS=para>
This small package defines the classes and interfaces
required for distributed garbage collection (DGC).

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.rmi.registry</tt><br>
<DD>

<P CLASS=para>
This is another small package that defines the classes and
interfaces required for a Java client to look up a remote
object by name or for a Java server to advertise the service
it provides.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.rmi.server</tt><br>
<DD>

<P CLASS=para>
This package is the largest of the RMI packages and is at
the heart of Remote Method Invocation.  It defines the
classes and interface that allow a Java program to create an
object that can be used remotely by other Java programs.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.security</tt><br>
<DD>

<P CLASS=para>
This package contains the classes and interfaces that
represent the fundamental abstractions of cryptographic
security: public and private keys, certificates, message
digests, and digital signatures.  This package does not
provide implementations of these abstractions; by design,
the Java Security API is implementation independent.  Java
1.1 does include a default implementation, but vendor-specific
implementations may also be used in conjunction with this
package.  The default security implementation relies on the <tt CLASS=literal>BigInteger</tt>
class defined in the <tt CLASS=literal>java.math</tt> package.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.security.acl</tt><br>
<DD>

<P CLASS=para>
This package defines high-level interfaces, and some
exceptions, for manipulating access control lists.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.security.interfaces</tt><br>
<DD>

<P CLASS=para>
This package defines a few interfaces that are required for
the Java Security API's implementation-independent design.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.sql</tt><br>
<DD>

<P CLASS=para>
This package is the Java Database Connectivity (JDBC)
API.  The classes and interfaces it contains allow Java
programs to send SQL queries to databases and retrieve the
results of those queries.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.text</tt><br>
<DD>

<P CLASS=para>
The classes and interfaces in this package are used for
internationalization.  The package includes classes for formatting
dates, times, numbers, and textual messages in a manner
appropriate for the default locale, or for any specified
locale.  It also includes classes for collating strings
according to the rules of a given locale and iterating
through the characters, words, and sentences of a string in
a locale-specific manner.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.util</tt><br>
<DD>

<P CLASS=para>
As its name indicates, the <tt CLASS=literal>java.util</tt> package
contains miscellaneous utility classes.  In Java 1.1, new
classes have been added to this package to support the AWT
and Java Beans event model, to define "locales" and
"resource bundles" used for internationalization, and to
manipulate dates, times, and time zones.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>java.util.zip</tt><br>
<DD>

<P CLASS=para>
This package implements classes for computing checksums on
streams of data, and for compressing and archiving (and
uncompressing and unarchiving) streams of data, using
ZLIB compression library and ZIP and GZIP file formats.</DL>
</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch03_11.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch04_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Summary</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>Inner Classes</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
